
import { settoken } from '../../utils/auth';
import request from '../../utils/request'

export function loginAction  (formData)  {
  return async (dispatch) => {
    const {data} = await request.post('/authorizations',formData)
    console.log(data.token);
    
  // 存取token  到redux中
  dispatch ({
    type:'token/login',
    token:data.token
  })
  // token 存入内从当中
  settoken(data.token)
  }
}